﻿using HashFoo.MigratorFoo;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace HashFoo.MigratorFooTests
{
    [TestClass]
    public class SimpleMigrationInverterTests
    {
        [TestMethod]
        public void CanInvertAlterAddConstraint()
        {
            var upScript = MigrationSqlFixtures.AddForiegnKey;
            var inverter = new SimpleMigrationInverter();

            var downScript = inverter.InvertCommand(upScript);
            Assert.AreEqual(
                (object)MigrationSqlFixtures.AddForiegnKeyExpected.Trim().ToLowerInvariant(),
                downScript.Trim().ToLowerInvariant());
        }

        [TestMethod]
        public void CanInvertAddColumn()
        {
            var upScript = MigrationSqlFixtures.AddColumn;
            var inverter = new SimpleMigrationInverter();

            var downScript = inverter.InvertCommand(upScript);
            Assert.AreEqual(
                (object)MigrationSqlFixtures.AddColumnExpected.Trim().ToLowerInvariant(),
                downScript.Trim().ToLowerInvariant());
        }
    }
}
